//
//  MyOfferGoodsView.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/3.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MyOfferGoodsView.h"

@interface MyOfferGoodsView ()

@end

@implementation MyOfferGoodsView

-(id)initWithFrame:(CGRect)aFrame inSuperView:(UIView *)aSuperView{
    if (self = [super initWithFrame:aFrame inSuperView:aSuperView]) {
        self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
        //线
        for (int i=0; i<2; i++) {
            GLGWView * lineView = [[GLGWView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(44)*i + kWidthProportion_In_iPhoneTriploid(44), self.width - kWidthProportion_In_iPhoneTriploid(30), 1) inSuperView:self];
            lineView.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        }
        //
        NSArray * leftTitle = @[@"他的报价（不含运费）",@"货源钢厂",@"关联的商品"];
        for (int i=0; i<3; i++) {
            GLGWLabel * leftLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self];
            [leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
                make.top.equalTo(self.mas_top).offset(kHeightProportion_In_iPhoneTriploid(12)+kHeightProportion_In_iPhoneTriploid(45)*i);
                make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
            }];
            GLGWLabel * rightLabel;
            if (i<2) {
                rightLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:self];
                rightLabel.tag = 300+i;
                [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(self.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
                    make.top.equalTo(leftLabel);
                    make.height.equalTo(leftLabel);
                }];
            }else{
                GLGWButton * lookBut = [[GLGWButton alloc] initWithTitle:@"请查看" titleLableFont:SYSTEMFONT(14) titleLableColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self];
//                lookBut.backgroundColor = kRandomColor;
                [lookBut addTarget:self action:@selector(goodsInforAction) forControlEvents:UIControlEventTouchUpInside];
                [lookBut mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(self.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(16));
                    make.top.equalTo(leftLabel.mas_top).offset(-kHeightProportion_In_iPhoneTriploid(10));
                    make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(40)));
                    make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(90)));
                }];
                [lookBut setImage:[UIImage imageNamed:@"icon_chakan"] forState:UIControlStateNormal];
                lookBut.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
                [lookBut setImagePositionWithType:SSImagePositionTypeRight spacing:6];
            }
            if (i==0) {
                leftLabel.attributedText = [GLGWLabel bllChangeStr:leftTitle[i] changewithStr:@"（不含运费）" changeColoer:[UIColor colorWithHexString:@"#999999"] withFont:SYSTEMFONT(12)];
                rightLabel.attributedText = [GLGWLabel bllChangeStr:@"4000 元/吨" changewithStr:@"元/吨" changeColoer:[UIColor colorWithHexString:@"#999999"] withFont:SYSTEMFONT(14)];
            }else{
                leftLabel.text = leftTitle[i];
                rightLabel.text = @"河钢";
                rightLabel.textColor = kColor_Rule_Yellow;
            }
            //right
            
        }
    }
    return self;
}

-(void)goodsInforAction{
    if (self.Block_LookGoodsInfor) {
        self.Block_LookGoodsInfor();
    }
}

@end
